

<!doctype html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>skidl.bus module &#8212; SKiDL 1.2.2 documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
    <link rel="stylesheet" type="text/css" href="../_static/bizstyle.css?v=a66e137f" />
    
    <script src="../_static/documentation_options.js?v=fd7cadf9"></script>
    <script src="../_static/doctools.js?v=9a2dae69"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../_static/bizstyle.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <!--[if lt IE 9]>
    <script src="_static/css3-mediaqueries.js"></script>
    <![endif]-->
  </head><body>
    <h1 id="site-title"><a href="../../../"><img src="../../../images/slim_banner.png" width="100%"></a></h1>
    
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SKiDL 1.2.2 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">skidl.bus module</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-skidl.bus">
<span id="skidl-bus-module"></span><h1>skidl.bus module<a class="headerlink" href="#module-skidl.bus" title="Link to this heading">¶</a></h1>
<p>Handles buses.</p>
<dl class="py class">
<dt class="sig sig-object py" id="skidl.bus.Bus">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">skidl.bus.</span></span><span class="sig-name descname"><span class="pre">Bus</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">attribs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus" title="Link to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="skidl.skidlbaseobj.html#skidl.skidlbaseobj.SkidlBaseObject" title="skidl.skidlbaseobj.SkidlBaseObject"><code class="xref py py-class docutils literal notranslate"><span class="pre">SkidlBaseObject</span></code></a></p>
<p>This class collects one or more nets into a group that can be indexed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> – A string with the name of the bus.</p></li>
<li><p><strong>args</strong> – A list of ints, pins, nets, buses to attach to the net.</p></li>
</ul>
</dd>
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>attribs</strong> – A dictionary of attributes and values to attach to
the Net object.</p>
</dd>
</dl>
<p class="rubric">Example</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">n</span> <span class="o">=</span> <span class="n">Net</span><span class="p">()</span>
<span class="n">led1</span> <span class="o">=</span> <span class="n">Part</span><span class="p">(</span><span class="s2">&quot;Device&quot;</span><span class="p">,</span> <span class="s1">&#39;LED&#39;</span><span class="p">)</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">Bus</span><span class="p">(</span><span class="s1">&#39;B&#39;</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="n">n</span><span class="p">,</span> <span class="n">led1</span><span class="p">[</span><span class="s1">&#39;K&#39;</span><span class="p">])</span>
</pre></div>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.connect">
<span class="sig-name descname"><span class="pre">connect</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">pins_nets_buses</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.connect"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.connect" title="Link to this definition">¶</a></dt>
<dd><p>Return the bus after connecting one or more nets, pins, or buses.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>pins_nets_buses</strong> – One or more Pin, Net or Bus objects or
lists/tuples of them.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The updated bus with the new connections.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>You can connect nets or pins to a bus like so:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">p</span> <span class="o">=</span> <span class="n">Pin</span><span class="p">()</span>       <span class="c1"># Create a pin.</span>
<span class="n">n</span> <span class="o">=</span> <span class="n">Net</span><span class="p">()</span>       <span class="c1"># Create a net.</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">Bus</span><span class="p">(</span><span class="s1">&#39;B&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="c1"># Create a two-wire bus.</span>
<span class="n">b</span> <span class="o">+=</span> <span class="n">p</span><span class="p">,</span><span class="n">n</span>        <span class="c1"># Connect pin and net to B[0] and B[1].</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.copy">
<span class="sig-name descname"><span class="pre">copy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">num_copies</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">attribs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.copy"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.copy" title="Link to this definition">¶</a></dt>
<dd><p>Make zero or more copies of this bus.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>num_copies</strong> – Number of copies to make of this bus.</p>
</dd>
<dt class="field-even">Keyword Arguments<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>attribs</strong> – Name/value pairs for setting attributes for the copy.</p>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>A list of Bus copies or a Bus if num_copies==1.</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>Exception if the requested number</strong><strong> of </strong><strong>copies is a non-integer</strong><strong> or </strong><strong>negative.</strong> – </p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>An instance of a bus can be copied just by calling it like so:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">b</span> <span class="o">=</span> <span class="n">Bus</span><span class="p">(</span><span class="s1">&#39;A&#39;</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>  <span class="c1"># Create a bus.</span>
<span class="n">b_copy</span> <span class="o">=</span> <span class="n">b</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>   <span class="c1"># Get two copies of the bus.</span>
</pre></div>
</div>
<p>You can also use the multiplication operator to make copies:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">b</span> <span class="o">=</span> <span class="mi">10</span> <span class="o">*</span> <span class="n">Bus</span><span class="p">(</span><span class="s1">&#39;A&#39;</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>  <span class="c1"># Create an array of buses.</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.extend">
<span class="sig-name descname"><span class="pre">extend</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">objects</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.extend"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.extend" title="Link to this definition">¶</a></dt>
<dd><p>Extend bus by appending objects to the end (MSB).</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.fetch">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">fetch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">attribs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.fetch"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.fetch" title="Link to this definition">¶</a></dt>
<dd><p>Get the bus with the given name from a circuit, or create it if not found.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.get">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">circuit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.get"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.get" title="Link to this definition">¶</a></dt>
<dd><p>Get the bus with the given name from a circuit, or return None.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.get_nets">
<span class="sig-name descname"><span class="pre">get_nets</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.get_nets"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.get_nets" title="Link to this definition">¶</a></dt>
<dd><p>Return the list of nets contained in this bus.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.get_pins">
<span class="sig-name descname"><span class="pre">get_pins</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.get_pins"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.get_pins" title="Link to this definition">¶</a></dt>
<dd><p>It’s an error to get the list of pins attached to all bus lines.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.insert">
<span class="sig-name descname"><span class="pre">insert</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">index</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">objects</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.insert"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.insert" title="Link to this definition">¶</a></dt>
<dd><p>Insert objects into bus starting at indexed position.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.is_implicit">
<span class="sig-name descname"><span class="pre">is_implicit</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.is_implicit"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.is_implicit" title="Link to this definition">¶</a></dt>
<dd><p>Return true if the bus name is implicit.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="skidl.bus.Bus.is_movable">
<span class="sig-name descname"><span class="pre">is_movable</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/skidl/bus.html#Bus.is_movable"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#skidl.bus.Bus.is_movable" title="Link to this definition">¶</a></dt>
<dd><p>Return true if all the nets in a bus are movable to another circuit.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.bus.Bus.name">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#skidl.bus.Bus.name" title="Link to this definition">¶</a></dt>
<dd><p>Get, set and delete the name of the bus.</p>
<p>When setting the bus name, if another bus with the same name
is found, the name for this bus is adjusted to make it unique.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.bus.Bus.pins">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">pins</span></span><a class="headerlink" href="#skidl.bus.Bus.pins" title="Link to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="skidl.bus.Bus.width">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">width</span></span><a class="headerlink" href="#skidl.bus.Bus.width" title="Link to this definition">¶</a></dt>
<dd><p>Return width of a Bus, which is the same as using the len() operator.</p>
</dd></dl>

</dd></dl>

</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <div>
    <h3><a href="../index.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">skidl.bus module</a><ul>
<li><a class="reference internal" href="#skidl.bus.Bus"><code class="docutils literal notranslate"><span class="pre">Bus</span></code></a><ul>
<li><a class="reference internal" href="#skidl.bus.Bus.connect"><code class="docutils literal notranslate"><span class="pre">Bus.connect()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.copy"><code class="docutils literal notranslate"><span class="pre">Bus.copy()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.extend"><code class="docutils literal notranslate"><span class="pre">Bus.extend()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.fetch"><code class="docutils literal notranslate"><span class="pre">Bus.fetch()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.get"><code class="docutils literal notranslate"><span class="pre">Bus.get()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.get_nets"><code class="docutils literal notranslate"><span class="pre">Bus.get_nets()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.get_pins"><code class="docutils literal notranslate"><span class="pre">Bus.get_pins()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.insert"><code class="docutils literal notranslate"><span class="pre">Bus.insert()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.is_implicit"><code class="docutils literal notranslate"><span class="pre">Bus.is_implicit()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.is_movable"><code class="docutils literal notranslate"><span class="pre">Bus.is_movable()</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.name"><code class="docutils literal notranslate"><span class="pre">Bus.name</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.pins"><code class="docutils literal notranslate"><span class="pre">Bus.pins</span></code></a></li>
<li><a class="reference internal" href="#skidl.bus.Bus.width"><code class="docutils literal notranslate"><span class="pre">Bus.width</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>

  </div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/rst_output/skidl.bus.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">SKiDL 1.2.2 documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">skidl.bus module</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
    &#169; Copyright 2016-2024, Dave Vandenbout.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.3.7.
    </div>
  </body>
</html>